/* A 前端服务器 8088 */
const express = require("express");

const { createProxyMiddleware } = require("http-proxy-middleware");

const app = express();
app.use(express.static("./public"));

// app.get("/users", (req, res) => res.send({ a: 1 }));

// http://127.0.0.1:8088/users -> http://127.0.0.1:8080/users
app.use(
  createProxyMiddleware({
    target: "http://127.0.0.1:8080",
    changeOrigin: true,
  })
);

app.listen(8088, () => {
  console.log("http://127.0.0.1:8088");
});
